<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="./jquery-1.12.4.min.js"></script>

<body>
    <h1>移动端</h1>
    <script>
        function browserRedirect() {
            var sUserAgent = navigator.userAgent.toLowerCase();
            console.log(navigator.userAgent);
            var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
            var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
            var bIsMidp = sUserAgent.match(/midp/i) == "midp";
            var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
            var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
            var bIsAndroid = sUserAgent.match(/android/i) == "android";
            var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
            var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
            if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
                //跳转移动端页面
                // window.location = './yidong.html';
                return
            } else {
                window.location = './pc.html';
            }
        }
        browserRedirect();
        $.ajax({
            method: 'get',
            url: './test.json',
            success: function (data) {
                console.log(data)
            },
            error: function (err) {
                console.log(err);
            }
        })
    </script>
</body>

</html>